package com.example.project.projectspringcloud.service.impl.user;

import com.example.project.projectspringcloud.common.OperationException;
import com.example.project.projectspringcloud.dao.user.CommentMapper;
import com.example.project.projectspringcloud.entity.Page;
import com.example.project.projectspringcloud.entity.user.Comment;
import com.example.project.projectspringcloud.service.BaseService;
import com.example.project.projectspringcloud.service.user.UserCommentService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Comment Service
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserCommentServiceImpl extends BaseService<Comment, CommentMapper> implements UserCommentService {

    @Override
    public Comment get(Comment comment) {
        return super.mapper.selectOne(comment);
    }

    @Override
    public List<Comment> list(Page page, Comment comment) {
        return super.list(page, comment);
    }

    @Override
    public boolean save(Comment comment) {
        return super.save(comment);
    }

    @Override
    public boolean delete(Integer[] ids) {
        return super.mapper.deleteByArrayPrimaryKey(ids) > 0;
    }

    @Override
    public int count(Comment comment) {
        return super.mapper.count(comment);
    }
}
